#include "EmptyKvTableFixture.h"
// insert tps  for kv-sqlite (MemoryDB, FileDB)
//OK:   whole sql (base)
//OK:		sql-bind
//TODO:   whole sql(shortcut, stream)

/*
class InsertingFileDB : public FileDBWithEmptyTable {
};

// WholeSql SYNC_ON NO-WAL
BENCHMARK_DEFINE_F(InsertingFileDB, SYNC_ON_NOWAL_80K)(::benchmark::State & state) {
  action("PRAGMA synchronous = ON;");
  action("PRAGMA cache_size = 80000;");
  for(auto _ : state){
      action("insert into tab1 values(null, '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678');");
  }
}
BENCHMARK_REGISTER_F(InsertingFileDB, SYNC_ON_NOWAL_80K)
  ->Unit(benchmark::kMillisecond)
  ->Iterations(100);

// WholeSql SYNC_ON WAL
BENCHMARK_DEFINE_F(InsertingFileDB, SYNC_ON_WAL_80K)(::benchmark::State & state) {
  action("PRAGMA synchronous = ON;");
  action("PRAGMA journal_mode = WAL;");
  action("PRAGMA cache_size = 80000;");
  for(auto _ : state){
      action("insert into tab1 values(null, '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678');");
  }
}
BENCHMARK_REGISTER_F(InsertingFileDB, SYNC_ON_WAL_80K)
  ->Unit(benchmark::kMillisecond)
  ->Iterations(1000);









// WholeSql SYNC=OFF NO-WAL
BENCHMARK_DEFINE_F(InsertingFileDB, SYNC_OFF_NOWAL_80K)(::benchmark::State & state) {
  action("PRAGMA synchronous = OFF;");
  action("PRAGMA cache_size = 80000;");
  for(auto _ : state){
      action("insert into tab1 values(null, '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678');");
  }
}
BENCHMARK_REGISTER_F(InsertingFileDB, SYNC_OFF_NOWAL_80K)
  ->Unit(benchmark::kMillisecond)
  ->Iterations(1000);


// WholeSql SYNC=OFF WAL
BENCHMARK_DEFINE_F(InsertingFileDB, SYNC_OFF_WAL_80K)(::benchmark::State & state) {
  action("PRAGMA synchronous = OFF;");
  action("PRAGMA journal_mode = WAL;");
  action("PRAGMA cache_size = 80000;");
  for(auto _ : state){
      action("insert into tab1 values(null, '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678');");
  }
}


BENCHMARK_REGISTER_F(InsertingFileDB, SYNC_OFF_WAL_80K)
  ->Unit(benchmark::kMillisecond)
  ->Iterations(10000);








// Sql-Bind
BENCHMARK_DEFINE_F(InsertingFileDB, sqlBind_SYNC_ON_WAL_80K)(::benchmark::State & state) {
  action("PRAGMA synchronous = ON;");
  action("PRAGMA journal_mode = WAL;");
  action("PRAGMA cache_size = 80000;");
  std::string str("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678");

  for(auto _ : state){
      action_bind("insert into tab1 values(null, ?);", str);
  }
}
BENCHMARK_REGISTER_F(InsertingFileDB, sqlBind_SYNC_ON_WAL_80K)
  ->Unit(benchmark::kMillisecond)
  ->Iterations(10000)
  ;

BENCHMARK_DEFINE_F(InsertingFileDB, sqlBind_SYNC_OFF_WAL_80K)(::benchmark::State & state) {
  action("PRAGMA synchronous = OFF;");
  action("PRAGMA journal_mode = WAL;");
  action("PRAGMA cache_size = 80000;");
  std::string str("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678");

  for(auto _ : state){
      action_bind("insert into tab1 values(null, ?);", str);
  }
}
BENCHMARK_REGISTER_F(InsertingFileDB, sqlBind_SYNC_OFF_WAL_80K)
  ->Unit(benchmark::kMillisecond)
  ->Iterations(10000)
  ;
*/





class InsertingMemoryDB : public MemoryDBWithEmptyTable {
};

BENCHMARK_DEFINE_F(InsertingMemoryDB, SYNC_OFF_WAL_80K)(::benchmark::State & state) {
  action("PRAGMA synchronous = OFF;");
  action("PRAGMA journal_mode = WAL;");
  action("PRAGMA cache_size = 80000;");
  for(auto _ : state){
      action("insert into tab1 values(null, '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678');");
  }
		
}

BENCHMARK_REGISTER_F(InsertingMemoryDB, SYNC_OFF_WAL_80K)
  ->Unit(benchmark::kMillisecond)
  ->Iterations(10000);
